﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MVCManage.Model;
using MVCManage.BLL;

namespace MVCManage.Api.Controllers
{
    public class GoodsTypeController : ApiController
    {
       
        GoodsTypeBLL bll = new GoodsTypeBLL();
        // GET: api/GoodsType
        public ResultData<List<GoodTypeDto>> Get()
        {
            var zhi = bll.Query();
            var list = from n in zhi
                       select new GoodTypeDto()
                       {
                             GTID = n.gtId,
                             Icon=n.icon,
                             Is_Show_Backstage = n.is_show_backstage,
                             Name= n.name,
                             Sort=n.sort
                       };
            ResultData<List<GoodTypeDto>> result = new ResultData<List<GoodTypeDto>>();
            result.code = 1;
            result.data = list.ToList();
            return result;
           
        }

        // GET: api/GoodsType/5
       

        // POST: api/GoodsType
        public void Post([FromBody]string value)
        {
        }

        // PUT: api/GoodsType/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE: api/GoodsType/5
        public void Delete(int id)
        {
        }
    }
}
